﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WebEntities.Models.ProductInfo
{
    public class Product
    {
        public int ProductID { get; set; }
        public string ProductName { get; set; }
        public int? ProdCataID { get; set; }
        public string ProdCataName { get; set; }
        public string ProductType { get; set; }
        public string UnitPrice { get; set; }
        public string Company { get; set; }
        public string Brand { get; set; }
        public string Address { get; set; }
        public string AppDomain { get; set; }
        public int? CaseID { get; set; }
        public string Keywords { get; set; }
        public string Description { get; set; }
        public string ProductCover { get; set; }
        public byte? IsShow { get; set; }
        public int? SortNum { get; set; }
        public DateTime CreateTime { get; set; }
        public string Creator { get; set; }
        public string ProductLevel { get; set; }
        public string Package { get; set; }
        public string ExpDate { get; set; }
        public string StoreCondition { get; set; }

        public static Product AsProduct(PP_Product pprod, string prodCataName)
        {
            Product prod = new Product
            {
                ProductID = pprod.ProductID,
                ProductName = pprod.ProductName,
                ProdCataID = pprod.ProdCataID,
                ProdCataName = prodCataName,
                ProductType = pprod.ProductType,
                UnitPrice = pprod.UnitPrice,
                Company = pprod.Company,
                Brand = pprod.Brand,
                Address = pprod.Address,
                AppDomain = pprod.AppDomain,
                CaseID = pprod.CaseID,
                Keywords = pprod.Keywords,
                Description = pprod.Description,
                ProductCover = pprod.ProductCover,
                IsShow = pprod.IsShow,
                SortNum = pprod.SortNum,
                CreateTime = pprod.CreateTime,
                Creator = pprod.Creator,
                ProductLevel = pprod.ProductLevel,
                Package = pprod.Package,
                ExpDate = pprod.ExpDate,
                StoreCondition = pprod.StoreCondition
            };
            return prod;
        }
    }
}
